package com.ktgj.customer.mapper;

import java.math.BigDecimal;
import java.util.List;

import com.ktgj.customer.domain.Card;
import com.ktgj.customer.domain.Customer;
import com.ktgj.customer.domain.CustomerRightdetail;
import com.ktgj.customer.domain.dto.RightCouponDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * 会员权益Mapper接口
 * 
 * @author ruoyi
 * @date 2021-07-30
 */
@Repository
public interface CustomerRightdetailMapper 
{
    /**
     * 查询会员权益
     * 
     * @param icustomerRightdetailD 会员权益ID
     * @return 会员权益
     */
    public CustomerRightdetail selectCustomerRightdetailById(Long icustomerRightdetailD);
    /**
     * 我的-会员状态
     *
     * @param customerId 会员权益ID
     * @return 会员权益
     */
    public List<CustomerRightdetail> selectCustomerRightdetailByCustomerId(Long customerId);

    /**
     * 查询会员权益列表
     * 
     * @param customerRightdetail 会员权益
     * @return 会员权益集合
     */
    public List<CustomerRightdetail> selectCustomerRightdetailList(CustomerRightdetail customerRightdetail);

    /**
     * 新增会员权益
     * 
     * @param customerRightdetail 会员权益
     * @return 结果
     */
    public int insertCustomerRightdetail(CustomerRightdetail customerRightdetail);

    /**
     * 修改会员权益
     * 
     * @param customerRightdetail 会员权益
     * @return 结果
     */
    public int updateCustomerRightdetail(CustomerRightdetail customerRightdetail);

    /**
     * 删除会员权益
     * 
     * @param icustomerRightdetailD 会员权益ID
     * @return 结果
     */
    public int deleteCustomerRightdetailById(Long icustomerRightdetailD);

    /**
     * 批量删除会员权益
     * 
     * @param icustomerRightdetailDs 需要删除的数据ID
     * @return 结果
     */
    public int deleteCustomerRightdetailByIds(Long[] icustomerRightdetailDs);

    public int insertBatch(@Param("customerRightdetails") List<CustomerRightdetail> customerRightdetails);

    List<CustomerRightdetail> selectCustomerRightdetailByBusinessOrderSubId(@Param("orderSubId") Long orderSubId);

    int updateCustomerRightdetailToFrozen(Long cardId);

    int updateCustomerRightdetailTowardFrozen(Long cardId);

    int updateCustomerRightdetailToRefunds(Long cardId);

    /**
     * 我的-优惠劵状态(显示)
     * */
    public CustomerRightdetail selectRightdetailByCustomerId(Long customerId);

    /**
     * 我的-优惠劵状态（更新）
     * @param customerRightdetail
     * @return
     */
    public int updateRightdetailByCustomerId(CustomerRightdetail customerRightdetail);

    /**
     * 我的-优惠券数量
     * */
    public Long selectCustomerRightdetailCount(Long customerId);

    /**
     * 根据会员id查询会员权益id列表
     * */
    public List<CustomerRightdetail> selectCustomerRightdetailNumberByCustomerId(Long customerId);

    /**
     * 查询优惠券状态
     * */
    public CustomerRightdetail equityStatus(@Param("customerId") Long customerId, @Param("rightdetailTypeid") Long rightdetailTypeid);

    /**
     * 优惠券列表
     * */
    public List<CustomerRightdetail> CustomerRightdetailList(@Param("customerId") Long customerId, @Param("type") String type);

    CustomerRightdetail selectGuaranteeByCustomerCardId(Long cardId);


    /**
     * crm会员信息
     */
    List<RightCouponDTO> getCustomerTravelMoney(Long customerId);

    BigDecimal queryUseCommodityMoney(Long customerId);

    /**
     * 查询会员是否有贵宾厅无限券
     * */
    public CustomerRightdetail infiniteVIPHall(@Param("id") Long id, @Param("couponId") Long couponId);
}
